<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>{$SETTING.website_name}</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="/static/adminlte/plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- icheck bootstrap -->
  <link rel="stylesheet" href="/static/adminlte/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="/static/adminlte/dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition login-page">
<div class="login-box">
  <div class="login-logo">
    欢迎使用
  </div>
  <!-- /.login-logo -->
  <div class="card">
    <div class="card-body login-card-body">
      <p class="login-box-msg">登录</p>

      <form action="" method="post" id="myform">
        <div class="input-group mb-3">
          <input name="username" type="text" class="form-control" placeholder="账号" autocomplete="off">
          <div class="input-group-append">
            <div class="input-group-text">
              <span class="fas fa-user"></span>
            </div>
          </div>
        </div>
        <div class="input-group mb-3">
          <input name="password" type="password" class="form-control" placeholder="密码" autocomplete="off">
          <div class="input-group-append">
            <div class="input-group-text">
              <span class="fas fa-lock"></span>
            </div>
          </div>
        </div>
        <div class="input-group mb-3">
            <input name="code" type="text" class="form-control" placeholder="验证码" autocomplete="off">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-image"></span>
              </div>
            </div>
          </div>
        <div class="row">
          <div class="col-12">
              <img src="/index/code" alt="" id="code">
          </div>
        </div>  
        <div class="row">
          <div class="col-8">
            <div class="icheck-primary">
              
            </div>
          </div>
          <!-- /.col -->
          <div class="col-4">
            <button type="submit" class="btn btn-primary btn-block">登录</button>
          </div>
          <!-- /.col -->
        </div>
      </form>


    </div>
    <!-- /.login-card-body -->
  </div>
</div>
<!-- /.login-box -->

<!-- jQuery -->
<script src="/static/adminlte/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/static/adminlte/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/adminlte/dist/js/adminlte.min.js"></script>

<script src="/static/js/jquery.form.js"></script>

<script>
$(document).ready(function(){
  $('#code').click(function(){
    $(this).attr('src','/index/code?r='+Math.random());
  });

  $('#myform').submit(function(){
    var addondata={
        
    };
		var options = {
			data:addondata,
			type: "post",
			beforeSubmit: function(){},
			success: function(data){
				if(parseInt(data.code)>0){
					alert(data.msg);	
					location.href='/frameset/index';
				}else{
					alert(data.msg);
          if(data.msg=='验证码不正确'){
            $('input[name=code]').val('');
            $('input[name=code]').focus();
            $('#code').click();
          }
				}
			},
			dataType: "json",
			clearForm: false,
			resetForm: false,
			timeout: 5000
		};
		$(this).ajaxSubmit(options);
		
		return false;	
	});

});
</script>
</body>
</html>
